Repository navigation
drm/vc4: Fix out of order frames during asynchronous page flips - #4571
Conversation
|
Not seeing any change issues with kodi on a Pi4 (which doesn't use asynchronous flips). I'm not sure I have a use case that triggers the original bug, so can't test for that. |
When doing an asynchronous page flip (PAGE_FLIP ioctl with the DRM_MODE_PAGE_FLIP_ASYNC flag set), the current code waits for the possible GPU buffer being rendered through a call to vc4_queue_seqno_cb(). On the BCM2835-37, the GPU driver is part of the vc4 driver and that function is defined in vc4_gem.c to wait for the buffer to be rendered, and once it's done, call a callback. However, on the BCM2711 used on the RaspberryPi4, the GPU driver is separate (v3d) and that function won't do anything. This was working because we were going into a path, due to uninitialized variables, that was always scheduling the callback. However, we were never actually waiting for the buffer to be rendered which was resulting in frames being displayed out of order. The generic API to signal those kind of completion in the kernel are the DMA fences, and fortunately the v3d drivers supports them and signal when its job is done. That API also provides an equivalent function that allows to have a callback being executed when the fence is signalled as done. Let's change our driver a bit to rely on the previous function for the older SoCs, and on DMA fences for the BCM2711. Signed-off-by: Maxime Ripard <maxime@cerno.tech>
3fa66e8 to
bc78913
Compare
|
What's the position with this PR? Is the force-push a change or just a rebase? |
|
The first version had a regression that would get an asynchronous page flip stuck indefinitely if the buffer it switches to had a fence but was already signalled before we would wait for it. This new version fixed it in my setup but I'm still waiting for additional testing. This new version is thus both that fix and a rebase |
|
Thanks - in the absence of any independent confirmation of a fix I'll accept confirmation of Kodi still working. |
|
The original reporter just confirmed that the original issue is now fixed and the regression is no longer there. So if Kodi is happy as well, I think this can be merged |
|
Kodi is still happy with updated version of this (although I don't believe it uses the async code path). |
|
Indeed, it doesn't use the async code path |
|
Thanks! |
See: raspberrypi/linux#4571 kernel: rpi-5.10.y fixups See: raspberrypi/linux#4608 kernel: Add IMX519 driver and device tree overlay See: raspberrypi/linux#4548 kernel: dtoverlays: Add overlay for ST7735R (160x128) TinyDRM driver See: raspberrypi/linux#4615
See: raspberrypi/linux#4571 kernel: rpi-5.10.y fixups See: raspberrypi/linux#4608 kernel: Add IMX519 driver and device tree overlay See: raspberrypi/linux#4548 kernel: dtoverlays: Add overlay for ST7735R (160x128) TinyDRM driver See: raspberrypi/linux#4615
When doing an asynchronous page flip (PAGE_FLIP ioctl with the
DRM_MODE_PAGE_FLIP_ASYNC flag set), the current code waits for the
possible GPU buffer being rendered through a call to
vc4_queue_seqno_cb().
On the BCM2835-37, the GPU driver is part of the vc4 driver and that
function is defined in vc4_gem.c to wait for the buffer to be rendered,
and once it's done, call a callback.
However, on the BCM2711 used on the RaspberryPi4, the GPU driver is
separate (v3d) and that function won't do anything. This was working
because we were going into a path, due to uninitialized variables, that
was always scheduling the callback.
However, we were never actually waiting for the buffer to be rendered
which was resulting in frames being displayed out of order.
The generic API to signal those kind of completion in the kernel are the
DMA fences, and fortunately the v3d drivers supports them and signal
when its job is done. That API also provides an equivalent function that
allows to have a callback being executed when the fence is signalled as
done.
Let's change our driver a bit to rely on the previous function for the
older SoCs, and on DMA fences for the BCM2711.
We should probably wait a bit for some more testing before merging this.